package com.tem.product.utils;

import com.api.manage.redis.RedisCacheUtil;
import com.tem.product.service.ISysCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

@Component
@Lazy
public class LocalRedisUtils {
    @Autowired
    private RedisCacheUtil redisCacheUtil;
    @Autowired
    private ISysCategoryService sysCategoryService;
    /**
     * 获取栏目path名称
     * @param path
     * @param myId
     * @return
     */
    public String getPathName(String path,Long myId){
        String pathName = redisCacheUtil.getName(RedisCacheUtil.SysCategoryPathName , myId);
        if(pathName==null){
            pathName = sysCategoryService.getPathName(path,myId.toString());
            redisCacheUtil.setName(RedisCacheUtil.SysCategoryPathName,myId,pathName);
        }
        return pathName;
    }
}